import pandas as pd
import re

df = pd.read_csv('../static/data/info.csv')
df['创建时间'] = df['创建时间'].apply(lambda x: x.split(' ')[0])
df['年份'] = df['创建时间'].apply(lambda x: x.split('-')[0])
df['简介'] = df['简介'].apply(lambda x: x.replace('\n', ''))
df['收藏'] = df['收藏'].apply(lambda x: x.replace('\n', '').replace('万', '0000'))
df['收藏'] = df['收藏'].apply(lambda x: re.findall(r'\d+', x)[0]).astype(int)
df['分享'] = df['分享'].apply(lambda x: '0' if '分享' in x else x)
df['分享'] = df['分享'].apply(lambda x: x.replace('万', '0000'))
df['分享'] = df['分享'].apply(lambda x: re.findall(r'\d+', x)[0]).astype(int)
df['评论'] = df['评论'].apply(lambda x: '0' if '评论' in x else x)
df['评论'] = df['评论'].apply(lambda x: x.replace('万', '0000'))
df['评论'] = df['评论'].apply(lambda x: re.findall(r'\d+', x)[0]).astype(int)
df.to_csv('../static/data/info_pre.csv', index=False)
